package org.iogame.dto;

import lombok.Data;
import org.iogame.util.JsonUtil;

/**
 * 对于数据的封装
 * @author lc
 * @since 2022/10/1
 */
@Data
public class Result {
    /** 0连接状态，1与ioGame的结果返回 **/
    private int router;
    private Object data;

    public String toJson(){
        return JsonUtil.toJson(this);
    }

    public static String buildResult(int router,Object data){
        Result result = new Result();
        result.setRouter(router);
        result.setData(data);
        return  result.toJson();
    }
}
